{% extends 'base.html' %}
{% block content %}
    <h3>zscan:<a><code>{{ name }}</code></a></h3>
    <div class="pull-left">
        <a class="btn btn-info btn-sm" href="{{ url_for('zsetSet', name=name) }}">
            <span class="glyphicon glyphicon-plus"></span> Add
        </a>
    </div>

    <div class="pull-right">
        <form class="form-inline" action="{{ url_for('zsetRange') }}">
            <div class="form-group">
                <label for="start_name">Start key</label>
                <input type="hidden" name="name" value="{{ name }}">
                <input type="text" class="form-control" id="start_name" name="start" value="{{ start }}"
                       placeholder="start key">
            </div>
            <div class="form-group">
                {% include 'select_size.html' %}
            </div>
            <button type="submit" class="btn btn-info btn-sm">Query</button>
        </form>
    </div>

    <div class="clear"></div>
    <form action="{{ url_for('zsetDel') }}" method="get">
        <input type="hidden" name="name" value="{{ name }}">
        <table class="table table-striped table-hover" id="data_list">
            <thead>
            <tr class="info">
                <th width="5%"><input type="checkbox" onclick="check_all(this)"></th>
                <th width="45%">Key</th>
                <th width="30%">Score</th>
                <th width="20%">Action</th>
            </tr>
            </thead>
            <tbody>
            {% for item in item_list %}
                <tr>
                    <td><input type="checkbox" value="{{ item.key }}" name="keys" class="cb"></td>
                    <td>
                        <a href="{{ url_for('zset_zget', name=name, key=item.key) }}">{{ item.key|safe|truncate(100, True) }}</a>
                    </td>
                    <td>{{ item.score }}</td>
                    <td>
                        <a href="{{ url_for('zsetSet', name=name, key=item.key, score=item.score) }}" class="btn btn-xs btn-info"
                           title="Edit"><span class="glyphicon glyphicon-pencil"></span></a>
                        <a href="{{ url_for('zsetDel', name=name, key=item.key) }}" class="btn btn-xs btn-danger"
                           title="Remove"><span class="glyphicon glyphicon-remove"></span></a>
                    </td>
                </tr>
            {% endfor %}
            </tbody>
        </table>
        With selected:
        <button type="submit" class="btn btn-danger btn-xs"><span class="glyphicon glyphicon-remove"></span></button>
    </form>
    {% include 'paging_tabs.html' %}
{% endblock %}